package com.example.mychatgpt.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.mychatgpt.entity.user;
import com.example.mychatgpt.mapper.userMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class userService {
    @Autowired
    userMapper my;
    public int checkValid(String account,String password){
        user toSearch= my.selectOne(new QueryWrapper<user>().eq("user_account",account));
        if(toSearch==null){
            return -2;
        }
        if(!toSearch.getUserPassword().equals(password)){
            return -1;
        }
        return toSearch.getUserId();
    }
}
